package com.type.dao;

import java.util.ArrayList;

import javax.annotation.Resource;

import org.hsqldb.lib.HashMap;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.stereotype.Repository;

import com.type.vo.AddresseeVO;
import com.type.vo.MailVO;

@Repository("TypeTenDAO")
public class TypeTenDAO {
	@Resource(name="sqlMapClientTemplate")
	private SqlMapClientTemplate sqlmap;
	
	public int selectMailNo() {
		return (Integer) sqlmap.queryForObject("mailTemplate.seqMailNo");
	}

	public void insertSendMailInfo(MailVO mail) {
		sqlmap.insert("mailTemplate.insertMailInfo",mail);
	}

	public void insertAddresseeInfo(AddresseeVO addressee) {
		sqlmap.insert("mailTemplate.insertAddressInfo",addressee);
	}
	
	@SuppressWarnings("unchecked")
	public ArrayList<AddresseeVO> selectAddresseeByMailNoNSender(int mailNo, String sender){
		HashMap map = new HashMap();
		map.put("mailNo", mailNo);
		map.put("sender", sender);
		return (ArrayList<AddresseeVO>) sqlmap.queryForList("mailTemplate.selectMailByNoSender",map);
	}
}
